package com.shopnight.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shopnight.entity.ShopOrder;
import com.shopnight.service.CartService;
import com.shopnight.service.ShopOrderService;
import com.shopnight.mapper.ShopOrderMapper;
import com.shopnight.vo.ResByIdOrder;
import com.shopnight.vo.ResOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
* @author 13201
* @description 针对表【shop_order】的数据库操作Service实现
* @createDate 2022-09-05 18:33:28
*/
@Service
public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder>
    implements ShopOrderService{

    @Autowired
    ShopOrderMapper shopOrderMapper;

    @Autowired
    CartService cartService;

    @Override
    public Page<ResOrder> getOrderByCategoryId(Page<ResOrder> page, Integer CategoryId) {
        Page<ResOrder> resPage = shopOrderMapper.getOrderByCategoryId(page,CategoryId);
        return  resPage;
    }

    @Override
    public  Page<ResOrder> getOrder(Integer orgId,Page<ResOrder> page) {
        Page<ResOrder> resPage = shopOrderMapper.getOrder(orgId,page);
        return  resPage;
    }

    @Override
    public  Page<ResOrder> getOrderByName(Integer orgId,Page<ResOrder> page, String orderName) {
        Page<ResOrder> resPage = shopOrderMapper.getOrderByName(orgId,page,orderName);
        return resPage;
    }

    public ShopOrder selectOrder(Integer orderId) {
        ShopOrder order = this.baseMapper.selectById(orderId);
        return order;
    }

    @Override
    public ResByIdOrder getOrderById(Integer orderId) {
        return  shopOrderMapper.getOrderById(orderId);
    }


    /*获取秒杀商品*/
    @Override
    public Page<ResOrder> getSeckillOrder(Integer orgId,Page<ResOrder> page) {
        Page<ResOrder> resPage = shopOrderMapper.getSeckillOrder(orgId,page);
        return resPage;
    }

    /*获取秒杀商品图片价格*/
    public List<Map<String,Object>> getSeckillModule(Integer orgId) {
        return shopOrderMapper.getSeckillModule(orgId);
    }


}




